import Vue from 'vue'
import { showDlg } from 'boot/utils'

import LeftPanel from './LeftPanel.vue'
import RightPanel from './RightPanel.vue'
// 浮动面板表
export const FLOAT_PANEL = {
  left: LeftPanel,
  right: RightPanel
}

// 浮动面板名称列表
export const FLOAT_PANEL_NAMES = Object.keys(FLOAT_PANEL)

// 浮动面板自定义参数
const FLOAT_PANEL_PARAMS = {
  left: {
    minWidth: 100,
    minHeight: 80,
    cardClass: 'q-card--flat',
    cardStyle: {
      backgroundColor: '#09f3',
      border: 'solid 2px #1976d2cc'
    }
  }
}

// 显示浮动面板
export function showFloatPanel (name) {
  showDlg(FLOAT_PANEL[name], null, false, {
    minWidth: 300,
    minHeight: 200,
    resizable: true,
    okBtn: false,
    cancelBtn: false,
    transitionShow: '',
    transitionHide: '',
    ...Vue.store.state.main[name + 'PanelRect'],
    ...FLOAT_PANEL_PARAMS[name]
  })
}
